/**
 * Copyright 2021 Steve Jrong
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.stevejrong.android.apk.downloader.util;

import com.stevejrong.android.apk.downloader.common.Constants;

import java.io.File;
import java.io.IOException;

/**
 * Util - 文件操作工具类
 *
 * @author Steve Jrong
 * create date: 2021-05-15 8:23 PM
 * @since 1.0
 */
public final class FileUtil {

    /**
     * /**
     * 获取项目的根绝对路径
     *
     * @return 项目的根绝对路径
     */
    private static String getProjectAbsolutePath() {
        String projectAbsolutePath = null;

        File file = new File("");
        try {
            projectAbsolutePath = file.getCanonicalPath();
        } catch (IOException e) {
            e.printStackTrace();
        }

        return projectAbsolutePath;
    }

    /**
     * 获取Resources目录的绝对路径
     *
     * @return Resources目录的绝对路径
     */
    public static String getResourcesDirectoryAbsolutePath() {
        return getProjectAbsolutePath() + Constants.RESOURCES_DIRECTORY_RELATIVE_PATH.val();
    }
}
